# -*- coding: utf-8 -*-
# @Time    : 2020/10/9 18:46
# @Author  : huangwei
# @File    : src.py
# @Software: PyCharm
import cv2

src = cv2.imread("./images/watermark.jpg")

print(src.shape)

out = src[15:140, 170:525]

gray = cv2.cvtColor(out, cv2.COLOR_BGR2GRAY)
cv2.imshow("gray", gray)

ret, out2 = cv2.threshold(gray, 0, 255, cv2.THRESH_OTSU)

cv2.imshow("src", out2)
print(out2.shape)
out2 = cv2.resize(out2, (int(out2.shape[1]/2.5), int(out2.shape[0]/2.5)))
print(out2.shape)
cv2.imwrite("./output/gray.png", out2, [int(cv2.IMWRITE_JPEG_QUALITY), 255])



cv2.waitKey(0)